package dao;

import bean.Dispatcher;
import bean.Mannger;
import bean.UserLogin;
import bean.Usermes;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

//用户登录Dao
public interface UserLoginMapper {
 @Select("select * from userlogin where username=#{username} and password=#{password}")
 UserLogin isLogin(@Param("username") String username, @Param("password") String password);
 //此方法用户注册判断是否有重复用户名
 @Select("select * from userlogin where username=#{username}")
 UserLogin  getUserByName(@Param("username") String username);
 @Insert("insert into userlogin(username,password,usertype) values(#{username},#{password},#{usertype})")
 int  insertUser(UserLogin userLogin);
 //插入普通用户信息
 @Insert("insert into usermes(userid,username) values(#{userid},#{username})")
 int insertgeneralUser(Usermes usermes);
 //插入配送员用户信息
 @Insert("insert into dispatcher(userid,dispatchername) values(#{userid},#{dispatchername})")
 int insertDispather(Dispatcher dispatcher);
 //插入管理员用户信息
 @Insert("insert into mannger(userid,manngername) values(#{userid},#{manngername})")
 int insertMannger(Mannger mannger);
}
